package com.myres.struts2.action;

import org.springframework.context.ApplicationContext;

import com.myres.biz.ShopBiz;
import com.myres.model.Shop;
import com.myres.model.User;
import com.myres.spring.SpringUtils;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;

public class AddShopAction extends ActionSupport {
	private User user;
	private Shop shop;
	private ShopBiz shopBiz;
	
	
	
	public User getUser() {
		return user;
	}
	public void setUser(User user) {
		this.user = user;
	}
	public Shop getShop() {
		return shop;
	}
	public void setShop(Shop shop) {
		this.shop = shop;
	}
	public ShopBiz getShopBiz() {
		return shopBiz;
	}
	public void setShopBiz(ShopBiz shopBiz) {
		this.shopBiz = shopBiz;
	}
	/**
	 * @return
	 */
	public String execute() {
		// TODO Auto-generated method stub
		user = (User) ActionContext.getContext().getSession().get("user");
		shop.setOwner(user);
		shop.setStatus(Shop.SHOP_STATUS_OK);
		shopBiz.insertShop(shop);
		//shopBiz.insertUser(user);
		return SUCCESS;
	}
}